<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	//获得本项目的地址(例如: http://localhost:8080/MyApp/)赋值给basePath变量    
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>



<link rel="stylesheet" type="text/css" href="logincss/styles_login.css">

<div class="wrapper_login">

	<div class="container_login">
		<h1>Welcome</h1>
		<form class="form_login">
			<input id="login_user_name" type="text" placeholder="username" style="margin:0 auto;height:2.2em;color:#666;"/> 
			<input id="login_user_pwd" type="password" placeholder="password" style="margin:0 auto;height:2.2em;color:#666;"/> 
			<input id="loginbutton" type="button" onclick="tabUserLogin()" value="submit" style="margin-top:2em;"/>
			<p id="error_msg" style="margin: 0 auto; margin-top: 0.2em; width: 20em; font-size: 0.8em; z-index: 99; color: #FF3333;"></p>
		</form>
	</div>


	<ul class="bg-bubbles_login">
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
	</ul>

</div>


<script type="text/javascript">
		

		function tabUserLogin() {
			var user_name = $("#login_user_name").val();
			var user_pwd = $("#login_user_pwd").val();
			if (user_name != "" && user_pwd != "") {
				$.ajax({
					type : 'post',
					url : '<%=basePath%>web/admin/tabUser/tabUserLogin',
					data : {
						user_name : user_name,
						user_pwd : user_pwd
					},
					success : function(data) {
						if (data.success) {
							window.location.href="<%=basePath%>index.jsp";
					} else {
						$("#error_msg").text("用户名或密码错误");
					}
				}
			});
		} else {
			$("#error_msg").text("登录信息不能为空");
		}
	}
</script>
